<?php
namespace api\modules\v1\controllers;

use common\models\pay\Alipay;
use common\models\Status;
use Yii;
use yii\helpers\ArrayHelper;
use yii\web\IdentityInterface;
use yii\filters\auth\HttpHeaderAuth;
/**
 * Default controller for the `v1` module
 */
class NotifyController extends DefaultController
{

    public $modelClass = 'api\modules\v1\models\userFund\UserRechargeInfo';

    public function behaviors()
    {
        return ArrayHelper::merge(parent::behaviors(), [
            'authenticator' => [
                'class' =>  HttpHeaderAuth::className(),    //head头部验证
                'header' => 'access-token',
                'optional' => [                     //需要过滤掉不用token参数的方法
                    'alipay-notify',
                ]
            ]
        ]);
    }

    //------------------------  支付成功回调  -------------------------------------
    //支付宝支付成功回调
    public function actionAlipayNotify() {
        if (Yii::$app->request->isPost) {
            return (new Alipay())->notify();
        }
    }





}
